/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package VO;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Equipo03
 */
@Entity
@Table(name = "PERRO")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CPerro.findAll", query = "SELECT c FROM CPerro c"),
    @NamedQuery(name = "CPerro.findByCodPerro", query = "SELECT c FROM CPerro c WHERE c.codPerro = :codPerro")})
public class CPerro implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "COD_PERRO")
    private Integer codPerro;
    @Lob
    @Column(name = "NOMBREPERRO")
    private String nombreperro;
    @OneToMany(mappedBy = "codperro")
    private Collection<CPulga> cPulgaCollection;

    public CPerro() {
    }

    public CPerro(Integer codPerro) {
        this.codPerro = codPerro;
    }

    public Integer getCodPerro() {
        return codPerro;
    }

    public void setCodPerro(Integer codPerro) {
        this.codPerro = codPerro;
    }

    public String getNombreperro() {
        return nombreperro;
    }

    public void setNombreperro(String nombreperro) {
        this.nombreperro = nombreperro;
    }

    @XmlTransient
    public Collection<CPulga> getCPulgaCollection() {
        return cPulgaCollection;
    }

    public void setCPulgaCollection(Collection<CPulga> cPulgaCollection) {
        this.cPulgaCollection = cPulgaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codPerro != null ? codPerro.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CPerro)) {
            return false;
        }
        CPerro other = (CPerro) object;
        if ((this.codPerro == null && other.codPerro != null) || (this.codPerro != null && !this.codPerro.equals(other.codPerro))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "VO.CPerro[ codPerro=" + codPerro + " ]";
    }
    
}
